using Lcygcc.Infrastructure.Utility.IOC;
using System;
using System.Runtime.CompilerServices;

namespace Lcygcc.Infrastructure.Core
{
	public class EngineContext
	{
		public static IEngine Current
		{
			get
			{
				if (Singleton<IEngine>.Instance == null)
				{
					EngineContext.Initialize(false);
				}
				return Singleton<IEngine>.Instance;
			}
		}
		[MethodImpl(MethodImplOptions.Synchronized)]
		public static IEngine Initialize(bool forceRecreate)
		{
			if (Singleton<IEngine>.Instance == null || forceRecreate)
			{
				Singleton<IEngine>.Instance = new SmartCenterEngine();
				Singleton<IEngine>.Instance.Initialize();
			}
			return Singleton<IEngine>.Instance;
		}
	}
}
